//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteCandidate {
        private readonly ICandidateRepository _CandidateRepository;

        public DeleteCandidate(ICandidateRepository CandidateRepository) {
            _CandidateRepository = CandidateRepository;
        }

        public virtual void Execute(Guid candidateId) {
            var CandidateToDelete = _CandidateRepository.GetCandidate(candidateId);

            if (CandidateToDelete != null) {
                _CandidateRepository.Delete(candidateId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
